<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script>
    autoclinicText("clinicText");
    function autoclinicText(inpId) {
        var url = "${ctx}/oper/clinicItemDict/automatic?itemClass=C,D";
        autoComplete(inpId, url,
                function (data) {
                    var rows = [];
                    for (var i = 0; i < data.length; i++) {
                        rows[rows.length] = {
                            data: data[i],
                            value: data[i].id,
                            result: data[i].itemName
                        };
                    }
                    return rows;
                }, function (data, i, max) {
                    return data.itemName + "|   " + data.itemCode + "|   " + data.price + "元";
                }, function (event, data, formatted) {
                    $("#clinicId").val(data.id);
                })
    }
</script>

<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <ul class="nav nav-tabs">
            <li>
                <a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/sys/tUnitFz/index')">单位分组列表</a>
            </li>
            <li class="active">
                <a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/tunitvsclinic/tunitvsclinic/tUnitVsClinic/form?unitId=${tUnitVsClinic.unitId}&clinicName=${clinicName}')">
                    <c:choose>
                        <c:when test="${tUnitVsClinic.id==''|| tUnitVsClinic.id==null}">
                            分组项目添加
                        </c:when>
                        <c:otherwise>tUnitVsClinic修改</c:otherwise>
                    </c:choose>
                </a>
            </li>
        </ul>
        <section class="panel panel-default">
            <div class="panel-body">
                <div class="row">
                    <div class="col-lg-7">
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12">
                                    <form:form id="searchForm" class="form-inline">
                                        <div class="form-group">
                                            <label class="col-sm-6 control-label">单位分组名称：</label>

                                            <div class="col-sm-4 ">
                                                <input name="ictemCode" readonly class="form-control" maxlength="50"
                                                       value="${clinicName}"/>
                                            </div>
                                        </div>
                                    </form:form>
                                </div>
                            </div>
                            <table id="contentTable" class="table table-bordered table-striped mg-t datatable">
                                <thead>
                                <tr>
                                    <th style="display:none">id</th>
                                    <th style="display: none">分组ID</th>
                                    <th>诊疗项目id</th>
                                    <th>收费系数</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach items="${list}" var="tUnitVsClinic">
                                <tr>
                                    <td style="display:none">${tUnitVsClinic.id}</td>
                                    <td style="display: none"> ${tUnitVsClinic.unitId}</td>
                                    <td> ${tUnitVsClinic.clinicId}</td>
                                    <td> ${tUnitVsClinic.coefficient}</td>
                                    <td>
                                        <a href="#" class="applyBt btn btn-danger btn-xs"
                                           onclick="confirmExtend('确认要删除吗？',function(){delLoad('mainCenterDiv','${ctx}/tunitvsclinic/tunitvsclinic/tUnitVsClinic/delete?id=${tUnitVsClinic.id}','${ctx}/tunitvsclinic/tunitvsclinic/tUnitVsClinic/form?unitId=${tUnitVsClinic.unitId}&clinicName=${clinicName}')})">删除</a>
                                    </td>
                                </tr>
                                </c:forEach>

                            </table>
                        </div>
                    </div>
                    <div class="col-lg-5">
                        <form:form id="inputForm" data-parsley-validate="" modelAttribute="tUnitVsClinic"
                                   onsubmit="return formSaveLoad('mainCenterDiv','inputForm','${ctx}/tunitvsclinic/tunitvsclinic/tUnitVsClinic/save','${ctx}/tunitvsclinic/tunitvsclinic/tUnitVsClinic/form?unitId=${tUnitVsClinic.unitId}&clinicName=${clinicName}');"
                                   method="post" class="form-horizontal">
                            <form:hidden path="id"/>
                            <form:hidden path="clinicId"/>
                            <form:hidden path="unitId" value="${tUnitVsClinic.unitId}"/>
                            <%--<div class="form-group">--%>
                            <%--<label class="col-sm-2 control-label">分组ID：</label>--%>
                            <%--<div class="col-sm-4">--%>
                            <%--<form:input path="unitId" htmlEscape="false" class="form-control"  maxlength="64" />--%>
                            <%--</div>--%>
                            <%--</div>--%>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">诊疗项目名称：</label>

                                <div class="col-sm-4">
                                    <form:input path="" id="clinicText" htmlEscape="false" class="form-control"
                                                maxlength="64"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">收费系数：</label>

                                <div class="col-sm-4">
                                    <form:input  path="coefficient" htmlEscape="false" class="form-control"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存">&nbsp;
                                    <input id="btnCancel" class="btn" type="button" value="返 回"
                                           onclick="loadDiv('mainCenterDiv','${ctx}/sys/tUnitFz/index')">
                                </div>
                            </div>
                        </form:form>
                    </div>
                </div>
            </div>
        </section>
    </div>
</div>